############################################################################
##

include ../common/Makefile.common

############################################################################

if BUILD_WITH_MSVC
noinst_LIBRARIES = widgets.lst
else
noinst_LTLIBRARIES = libSoQtWidgets.la
endif

## Remove any linklibraries detected by configure, as they are not
## needed in the submodules -- only in the toplevel libSoQt build.

DEFAULT_INCLUDES = -I$(top_builddir)/src -I$(top_srcdir)/src
LIBS = 

## The moc_* files are sources generated by the Qt moc utility
## (necessary to get the signal-slot mechanisms of Qt working).


#	$(SoGui_src_Inventor_Gui_widgets_BuiltMetaFiles)
BUILT_SOURCES = \
	$(SoGui_src_Inventor_Gui_widgets_BuiltFiles) \
	moc_QtNativePopupMenu.icc \
	moc_SoQtThumbWheel.icc \
	moc_SoQtGLArea.icc

CLEANFILES = \
	$(SoGui_src_Inventor_Gui_widgets_BuiltMetaFiles)

DISTCLEANFILES = \
	$(SoGui_src_Inventor_Gui_widgets_BuiltFiles) \
	$(SoGui_src_Inventor_Gui_widgets_BuiltMetaFiles)

############################################################################

RegularSources = \
	SoQtGLArea.cpp SoQtGLArea.h \
	SoQtThumbWheel.cpp SoQtThumbWheel.h \
	QtNativePopupMenu.cpp QtNativePopupMenu.h

BuiltSources = \
	$(SoGui_src_Inventor_Gui_widgets_BuiltFiles)

LinkHackSources = \
	all-widgets-cpp.cpp

if HACKING_COMPACT_BUILD
BuildSources = $(LinkHackSources)
NoDistSources =
ExtraSources = $(RegularSources)
else
BuildSources = $(RegularSources)
NoDistSources = $(BuiltSources)
ExtraSources = $(LinkHackSources)
endif

############################################################################
# libtool setup

libSoQtWidgets_la_SOURCES = \
	$(BuildSources)

nodist_libSoQtWidgets_la_SOURCES = \
	$(NoDistSources)

############################################################################
# custom setup for Microsoft Visual C++ build

widgets_lst_SOURCES = \
	$(BuildSources)

nodist_widgets_lst_SOURCES = \
	$(NoDistSources)

widgets.lst: Makefile $(widgets_lst_OBJECTS)
	@echo "Linking $@..."; \
	rm -f $@; \
	for i in $(widgets_lst_OBJECTS); do echo $$i >>$@; done

############################################################################
# header installation

if MAC_FRAMEWORK
SoQtWidgetsincdir = $(MAC_FRAMEWORK_PREFIX)/$(MAC_FRAMEWORK_NAME).framework/Versions/$(MAC_FRAMEWORK_VERSION)/Headers/widgets
else
SoQtWidgetsincdir = $(includedir)/Inventor/@Gui@/widgets
endif
SoQtWidgetsinc_HEADERS = \
	SoQtThumbWheel.h

nodist_SoQtWidgetsinc_HEADERS = \
	SoQtPopupMenu.h

install-SoQtWidgetsincHEADERS: $(SoQtWidgetsinc_HEADERS)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(SoQtWidgetsincdir)
	@list='$(SoQtWidgetsinc_HEADERS)'; for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  src="$$d$$p"; dst="$(DESTDIR)$(SoQtWidgetsincdir)/$$f"; \
	  if cmp -s "$$src" "$$dst"; then :; else \
	    echo " $(INSTALL_HEADER) $$src $$dst"; \
	    $(INSTALL_HEADER) "$$src" "$$dst" || exit 1; \
	  fi; \
	done

install-nodist_SoQtWidgetsincHEADERS: $(nodist_SoQtWidgetsinc_HEADERS)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(SoQtWidgetsincdir)
	@list='$(nodist_SoQtWidgetsinc_HEADERS)'; for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  src="$$d$$p"; dst="$(DESTDIR)$(SoQtWidgetsincdir)/$$f"; \
	  if cmp -s "$$src" "$$dst"; then :; else \
	    echo " $(INSTALL_HEADER) $$src $$dst"; \
	    $(INSTALL_HEADER) "$$src" "$$dst" || exit 1; \
	  fi; \
	done

# **************************************************************************
# auto-generated Qt moc files.

# moc_SoQtGradientDialogP.icc: $(srcdir)/gradientp/SoQtGradientDialogP.h
# 	( cd $(top_builddir); \
# 	   $(MAKE) src/Inventor/Qt/widgets/$@ )
# 
# moc_SoQtColorTableEditorP.icc: $(srcdir)/curvep/SoQtColorTableEditorP.h
# 	( cd $(top_builddir); \
# 	   $(MAKE) src/Inventor/Qt/widgets/$@ )
# 
# moc_GradientView.icc: $(srcdir)/gradientp/GradientView.h
# 	( cd $(top_builddir); \
# 	   $(MAKE) src/Inventor/Qt/widgets/$@ )
# 
# moc_CurveView.icc: $(srcdir)/curvep/CurveView.h
# 	( cd $(top_builddir); \
# 	   $(MAKE) src/Inventor/Qt/widgets/$@ )

moc_QtNativePopupMenu.icc: $(srcdir)/QtNativePopupMenu.h
	( cd $(top_builddir); \
	   $(MAKE) src/Inventor/Qt/widgets/$@ )

moc_SoQtThumbWheel.icc: $(srcdir)/SoQtThumbWheel.h
	( cd $(top_builddir); \
	   $(MAKE) src/Inventor/Qt/widgets/$@ )

moc_SoQtGLArea.icc: $(srcdir)/SoQtGLArea.h
	( cd $(top_builddir); \
	   $(MAKE) src/Inventor/Qt/widgets/$@ )

# EOF ######################################################################
